import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { BaseItem } from "../common/BaseItem";
import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ItemData } from "../../resource/info/ItemData";
import { ColorConfig } from "../../resource/ColorConfig";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
//class FishDropItemRenderer
    
    export  class FishDropItemRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            var loc2=null;
            var loc1=GlobalClass.getBitmap("PackItemBg");
            loc1.width = 38;
            loc1.height = 38;
            loc1.y = 8;
            loc1.x = 5;
            this.addChild(loc1);
            this._itemText = new GTextFiled();
            this._itemText.width = 100;
            this._itemText.height = 20;
            this._itemText.x = 50;
            this._itemText.y = 17;
            this._itemText.textColor = 11661311;
            this._itemText.selectable = false;
            this._itemText.mouseEnabled = false;
            this.addChild(this._itemText);
            this._pic = new BaseItem();
            this._pic.setSize(32, 32);
            this._pic.x = 8;
            this._pic.y = 11;
            this._pic.isDragAble = false;
            this._pic.isDropAble = false;
            this.addChild(this._pic);
            loc2 = ResouceConst.getScaleBitmap("SplitLine");
            loc2.x = 0;
            loc2.y = 51;
            loc2.width = 182;
            this.addChild(loc2);
            this.mouseChildren = false;
            this.buttonMode = true;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=null;
            super.data = arg1;
            this._itemData = arg1 as ItemData;
            if (this._itemData && this._itemData.itemInfo) 
            {
                this._pic.itemData = this._itemData;
                loc1 = ColorConfig.instance.getItemColor(this._itemData.itemInfo.item.color);
                this._itemText.htmlText = HTMLUtil.addColor(this._itemData.itemInfo.item.name, loc1.color);
            }
            else 
            {
                this._pic.itemData = null;
                this._itemText.text = "";
            }
            return;
        }

        /* internal */ /* var */_pic: BaseItem;

        /* internal */ /* var */_itemText: GTextFiled;

        /* internal */ /* var */_itemData: ItemData;
    }
